import { Component, OnInit } from '@angular/core';
import { HttpRequest } from "../../../service/httpRequest";


@Component({
  selector: 'app-monitor-center',
  templateUrl: './monitor-center.component.html',
  styleUrls: ['./monitor-center.component.css']
})
export class MonitorCenterComponent implements OnInit {

  tdata:any;
  run:any;
  count = 1;
  constructor(private httpRequest:HttpRequest) { }

  ngOnInit() {

    this.httpRequest.sendGet('stat/tj').subscribe(res => {
      this.tdata = res;

    },err => console.log(err));
    //this.getRealTimeEvents();
    //this.run = setInterval(()=>{
    //  this.getRealTimeEvents();
    //}, 30000);
  }


  getRealTimeEvents():void{
    this.httpRequest.sendGet('stat/lunxun').subscribe(res => {
      console.log(res);

    },err => console.log(err));

    console.log(this.count++);
  }

  ngOnDestroy(){
    clearInterval(this.run);
  }
}
